///////////////////////////////////////////////////////////////////////////////////////////////////
/// \file formic/fqmc/jastrow_utility.h
///
/// \brief   header file for jastrow factor utility functions
///
///////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef FORMIC_FQMC_JASTROW_UTILITY_HEADER
#define FORMIC_FQMC_JASTROW_UTILITY_HEADER

#include<formic/numeric/numeric.h>

namespace formic {

  namespace fqmc {

    ///////////////////////////////////////////////////////////////////////////////////////////////////
    /// \brief returns the compound index of the ab jastrow element corresponding to orbitals i and j
    ///
    /// \param[in]      rest     whether or not the jastrow factor is restricted
    /// \param[in]      i        the 1st orbital index
    /// \param[in]      j        the 2nd orbital index
    /// \param[in]      n        the number of orbitals
    ///
    ///////////////////////////////////////////////////////////////////////////////////////////////////
    inline int jastrow_ab_cmpd_ind(const bool rest_jast, const int i, const int j, const int n) {
      return ( rest_jast ? formic::cmpd_pair_index_incl(std::min(i, j), std::max(i, j), n) : i * n + j );
    }

  }

}

#endif
